package day0711;

public class Test4 {
    public static void main(String[] args) {
        int b=0;
        //计算1----100的累加和
        for (int i = 1; i <= 100; i++) {
            b=i+b;
        }
        System.out.println(b);


        //计算所有数组元素的累加和
        int[]   a={6, 9, 3, 7, 8, 6};
        int d=0;
        for (int i = 0; i < a.length ; i++) {
            d=d+a[i];
        }
        System.out.println(d);

    }
}
